package com.ivi.car.module.maintain.view.adapter;

import android.view.View;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.ivi.car.R;
import com.ivi.car.bean.MaintainCarOrderBean;

import butterknife.ButterKnife;

/**
 * Created by zhaolong.han on 2018/3/7.
 */

public class MaintainCarOrderAdapter
    extends BaseQuickAdapter<MaintainCarOrderBean, MaintainCarOrderAdapter.holder> {

  public MaintainCarOrderAdapter() {
    super(R.layout.maintain_order_item);
  }

  @Override
  protected void convert(holder helper, MaintainCarOrderBean maintainCarOrderBean) {
    helper.setText(R.id.tv_title, maintainCarOrderBean.title)
        .setText(R.id.tv_titleStyle, maintainCarOrderBean.titleStyle)
        .setText(R.id.shopName, maintainCarOrderBean.shopName)
        .setText(R.id.timeDetail, maintainCarOrderBean.timeDetail);
    TextView textView = helper.getView(R.id.tv_titleStyle);
    int pos = helper.getPosition();
    if (pos == 0) {
      textView.setBackgroundResource(R.drawable.shape_tv_blue);
    } else if (pos == 1) {
        textView.setBackgroundResource(R.drawable.shape_tv_yellow);
    } else {
        textView.setBackgroundResource(R.drawable.shape_tv_green);
    }
  }

  public static class holder extends BaseViewHolder {
    public holder(View view) {
      super(view);
      ButterKnife.bind(this, view);
    }
  }
}
